
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>和Erlang互操作 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="error-handling.html" />
    
    
    <link rel="prev" href="../basics/iex-helpers.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        <li class="header">第一部分：基础</li>
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../basics/basics.html">
            
                <a href="../basics/basics.html">
            
                    
                    基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../basics/collections.html">
            
                <a href="../basics/collections.html">
            
                    
                    集合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../basics/enum.html">
            
                <a href="../basics/enum.html">
            
                    
                    Enum 模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../basics/pattern-matching.html">
            
                <a href="../basics/pattern-matching.html">
            
                    
                    模式匹配
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../basics/control-structures.html">
            
                <a href="../basics/control-structures.html">
            
                    
                    控制语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../basics/functions.html">
            
                <a href="../basics/functions.html">
            
                    
                    函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../basics/pipe-operator.html">
            
                <a href="../basics/pipe-operator.html">
            
                    
                    管道操作符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../basics/modules.html">
            
                <a href="../basics/modules.html">
            
                    
                    模块(Module)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../basics/mix.html">
            
                <a href="../basics/mix.html">
            
                    
                    Mix
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../basics/sigils.html">
            
                <a href="../basics/sigils.html">
            
                    
                    魔符(Sigil)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../basics/documentation.html">
            
                <a href="../basics/documentation.html">
            
                    
                    文档模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../basics/testing.html">
            
                <a href="../basics/testing.html">
            
                    
                    测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../basics/comprehensions.html">
            
                <a href="../basics/comprehensions.html">
            
                    
                    推导
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../basics/strings.html">
            
                <a href="../basics/strings.html">
            
                    
                    字符串
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="../basics/date-time.html">
            
                <a href="../basics/date-time.html">
            
                    
                    日期和时间
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="../basics/mix-tasks.html">
            
                <a href="../basics/mix-tasks.html">
            
                    
                    自定义Mix任务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="../basics/iex-helpers.html">
            
                <a href="../basics/iex-helpers.html">
            
                    
                    IEx辅助函数
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">第二部分：高级</li>
        
        
    
        <li class="chapter active" data-level="2.1" data-path="erlang.html">
            
                <a href="erlang.html">
            
                    
                    和Erlang互操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="error-handling.html">
            
                <a href="error-handling.html">
            
                    
                    错误处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="escripts.html">
            
                <a href="escripts.html">
            
                    
                    可执行文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="concurrency.html">
            
                <a href="concurrency.html">
            
                    
                    并发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="otp-concurrency.html">
            
                <a href="otp-concurrency.html">
            
                    
                    OTP并发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="otp-supervisors.html">
            
                <a href="otp-supervisors.html">
            
                    
                    OTP Supervisors
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="otp-distribution.html">
            
                <a href="otp-distribution.html">
            
                    
                    OTP 分布式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="metaprogramming.html">
            
                <a href="metaprogramming.html">
            
                    
                    元编程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="umbrella-projects.html">
            
                <a href="umbrella-projects.html">
            
                    
                    Umbrella Projects
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="typespec.html">
            
                <a href="typespec.html">
            
                    
                    Specifications and types
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="behaviours.html">
            
                <a href="behaviours.html">
            
                    
                    行为
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="gen-stage.html">
            
                <a href="gen-stage.html">
            
                    
                    GenStage
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13" data-path="protocols.html">
            
                <a href="protocols.html">
            
                    
                    协议
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.14" data-path="nerves.html">
            
                <a href="nerves.html">
            
                    
                    Nerves
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">第三部分：ECTO</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../ecto/basics.html">
            
                <a href="../ecto/basics.html">
            
                    
                    Basics
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="../ecto/changesets.html">
            
                <a href="../ecto/changesets.html">
            
                    
                    Changesets
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="../ecto/associations.html">
            
                <a href="../ecto/associations.html">
            
                    
                    关联关系
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="../ecto/querying.html">
            
                <a href="../ecto/querying.html">
            
                    
                    查询
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">第四部分：专题</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../specifics/plug.html">
            
                <a href="../specifics/plug.html">
            
                    
                    Plug
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="../specifics/eex.html">
            
                <a href="../specifics/eex.html">
            
                    
                    嵌入的 Elixir(EEx)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="../specifics/ets.html">
            
                <a href="../specifics/ets.html">
            
                    
                    Erlang 项式存储(ETS)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="../specifics/mnesia.html">
            
                <a href="../specifics/mnesia.html">
            
                    
                    Mnesia 数据库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="../specifics/debugging.html">
            
                <a href="../specifics/debugging.html">
            
                    
                    调试
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">第五部分：程序库</li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../libraries/guardian.html">
            
                <a href="../libraries/guardian.html">
            
                    
                    Guardian(基础)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="../libraries/poolboy.html">
            
                <a href="../libraries/poolboy.html">
            
                    
                    Poolboy
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="../libraries/benchee.html">
            
                <a href="../libraries/benchee.html">
            
                    
                    Benchee
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="../libraries/bypass.html">
            
                <a href="../libraries/bypass.html">
            
                    
                    Bypass
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.5" data-path="../libraries/distillery.html">
            
                <a href="../libraries/distillery.html">
            
                    
                    Distillery(基础)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.6" data-path="../libraries/stream-data.html">
            
                <a href="../libraries/stream-data.html">
            
                    
                    StreamData
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >和Erlang互操作</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <p>&#x5728; Erlang VM (BEAM) &#x4E0A;&#x6784;&#x5EFA; Elixir &#x7684;&#x597D;&#x5904;&#x4E4B;&#x4E00;&#x5C31;&#x662F;&#x5DF2;&#x7ECF;&#x6709;&#x5927;&#x91CF;&#x7684;&#x5E93;&#x53EF;&#x4EE5;&#x4F9B;&#x6211;&#x4EEC;&#x4F7F;&#x7528;&#x3002;&#x4E92;&#x64CD;&#x4F5C;&#x6027;&#x5141;&#x8BB8;&#x6211;&#x4EEC;&#x5728; Elixir &#x4EE3;&#x7801;&#x4E2D;&#x76F4;&#x63A5;&#x4F7F;&#x7528; Erlang &#x7684;&#x6807;&#x51C6;&#x5E93;&#x548C;&#x4E09;&#x65B9;&#x5E93;&#x3002;&#x8FD9;&#x8282;&#x8BFE;&#xFF0C;&#x6211;&#x4EEC;&#x5C31;&#x8BB2;&#x8BB2;&#x5982;&#x4F55;&#x6765;&#x505A;&#x3002;  </p>
<h2 id="&#x6807;&#x51C6;&#x5E93;">&#x6807;&#x51C6;&#x5E93;</h2>
<p>&#x5728;&#x4EFB;&#x4F55; Elixir &#x4EE3;&#x7801;&#x4E2D;&#x90FD;&#x80FD;&#x76F4;&#x63A5;&#x4F7F;&#x7528; Erlang &#x63D0;&#x4F9B;&#x7684;&#x6807;&#x51C6;&#x5E93;&#xFF0C;Erlang &#x7684;&#x6A21;&#x5757;&#x7528;&#x5C0F;&#x5199;&#x7684;&#x539F;&#x5B50;&#x53D8;&#x91CF;&#x8868;&#x793A;&#xFF0C;&#x6BD4;&#x5982; <code>:os</code> &#x548C; <code>:timer</code>&#x3002;  </p>
<p>&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x7528; <code>timer.tc</code> &#x8BA1;&#x7B97;&#x67D0;&#x4E2A;&#x51FD;&#x6570;&#x6267;&#x884C;&#x7684;&#x65F6;&#x95F4;&#xFF1A;  </p>
<pre><code class="lang-elixir"><span class="hljs-class"><span class="hljs-keyword">defmodule</span> <span class="hljs-title">Example</span></span> <span class="hljs-keyword">do</span>
  <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">timed</span></span>(fun, args) <span class="hljs-keyword">do</span>
    {time, result} = <span class="hljs-symbol">:timer</span>.tc(fun, args)
    IO.puts(<span class="hljs-string">&quot;Time: <span class="hljs-subst">#{time}</span> &#x3BC;s&quot;</span>)
    IO.puts(<span class="hljs-string">&quot;Result: <span class="hljs-subst">#{result}</span>&quot;</span>)
  <span class="hljs-keyword">end</span>
<span class="hljs-keyword">end</span>

iex&gt; Example.timed(<span class="hljs-keyword">fn</span> (n) -&gt; (n * n) * n <span class="hljs-keyword">end</span>, [<span class="hljs-number">100</span>])
<span class="hljs-symbol">Time:</span> <span class="hljs-number">8</span> &#x3BC;s
<span class="hljs-symbol">Result:</span> <span class="hljs-number">1000000</span>
</code></pre>
<p>&#x8981;&#x4E86;&#x89E3;&#x6240;&#x6709;&#x53EF;&#x7528;&#x7684;&#x6A21;&#x5757;&#xFF0C;&#x8BF7;&#x770B; <a href="http://erlang.org/doc/apps/stdlib/" target="_blank">Erlang &#x53C2;&#x8003;&#x624B;&#x518C;</a>&#x3002;  </p>
<h2 id="erlang-&#x7B2C;&#x4E09;&#x65B9;&#x4F9D;&#x8D56;">Erlang &#x7B2C;&#x4E09;&#x65B9;&#x4F9D;&#x8D56;</h2>
<p>&#x5728;&#x4E4B;&#x524D;&#x7684;&#x8BFE;&#x7A0B;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x8BB2;&#x8FC7;&#x5982;&#x4F55;&#x4F7F;&#x7528; Mix &#x548C;&#x7BA1;&#x7406;&#x4F9D;&#x8D56;&#x3002;&#x8981;&#x5F15;&#x5165; Erlang &#x7684;&#x4F9D;&#x8D56;&#xFF0C;&#x65B9;&#x6CD5;&#x4E5F;&#x662F;&#x4E00;&#x6837;&#x7684;&#x3002;&#x5982;&#x679C;&#x4F9D;&#x8D56;&#x7684; Erlang &#x5E93;&#x4E0D;&#x5728; <a href="https://hex.pm" target="_blank">hex</a>&#xFF0C;&#x4F60;&#x4E5F;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x4F7F;&#x7528; git &#x4EE3;&#x7801;&#x5E93;&#x7684;&#x5730;&#x5740;&#xFF1A;  </p>
<pre><code class="lang-elixir"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">deps</span></span> <span class="hljs-keyword">do</span>
  [{<span class="hljs-symbol">:png</span>, <span class="hljs-symbol">github:</span> <span class="hljs-string">&quot;yuce/png&quot;</span>}]
<span class="hljs-keyword">end</span>
</code></pre>
<p>&#x7136;&#x540E;&#x6211;&#x4EEC;&#x5C31;&#x53EF;&#x4EE5;&#x7528; Erlang &#x7684;&#x5E93;&#x4E86;&#xFF1A;  </p>
<pre><code class="lang-elixir">png =
  <span class="hljs-symbol">:png</span>.create(%{<span class="hljs-symbol">:size</span> =&gt; {<span class="hljs-number">30</span>, <span class="hljs-number">30</span>}, <span class="hljs-symbol">:mode</span> =&gt; {<span class="hljs-symbol">:indexed</span>, <span class="hljs-number">8</span>}, <span class="hljs-symbol">:file</span> =&gt; file, <span class="hljs-symbol">:palette</span> =&gt; palette})
</code></pre>
<h2 id="&#x533A;&#x522B;">&#x533A;&#x522B;</h2>
<p>&#x77E5;&#x9053;&#x4E86;&#x600E;&#x4E48;&#x5728; Elixir &#x4E2D;&#x4F7F;&#x7528; Erlang &#xFF0C;&#x6211;&#x4EEC;&#x8FD8;&#x8981;&#x8BB2;&#x8BB2;&#x64CD;&#x4F5C; Erlang &#x8BED;&#x8A00;&#x4F1A;&#x9047;&#x5230;&#x7684;&#x5751;&#xFF1A;  </p>
<h3 id="&#x539F;&#x5B50;">&#x539F;&#x5B50;</h3>
<p>Erlang &#x7684;&#x539F;&#x5B50;&#x548C; Elixir &#x5F88;&#x76F8;&#x4F3C;&#xFF0C;&#x53EA;&#x662F;&#x6CA1;&#x6709;&#x524D;&#x9762;&#x7684;&#x5192;&#x53F7;&#xFF08;<code>:</code>&#xFF09;&#xFF0C;Erlang &#x4E2D;&#x7684;&#x539F;&#x5B50;&#x662F;&#x5C0F;&#x5199;&#x5B57;&#x6BCD;&#x548C;&#x4E0B;&#x5212;&#x7EBF;&#x7684;&#x7EC4;&#x5408;&#x3002;  </p>
<p>Elixir:  </p>
<pre><code class="lang-elixir"><span class="hljs-symbol">:example</span>
</code></pre>
<p>Erlang:  </p>
<pre><code class="lang-erlang">example.
</code></pre>
<h3 id="&#x5B57;&#x7B26;&#x4E32;">&#x5B57;&#x7B26;&#x4E32;</h3>
<p>&#x5728; Elixir &#x91CC;&#x9762;&#xFF0C;&#x5B57;&#x7B26;&#x4E32;&#x8868;&#x8FBE;&#x7684;&#x662F; UTF-8 &#x7F16;&#x7801;&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x6570;&#x636E;&#x3002;&#x800C;&#x5728; Erlang&#xFF0C;&#x5B57;&#x7B26;&#x4E32;&#x8FD8;&#x662F;&#x4F7F;&#x7528;&#x53CC;&#x5F15;&#x53F7;&#x8868;&#x793A;&#xFF0C;&#x4F46;&#x662F;&#x5374;&#x662F;&#x5B57;&#x7B26;&#x5217;&#x8868;&#x3002;  </p>
<p>Elixir:  </p>
<pre><code class="lang-elixir">iex&gt; is_list(<span class="hljs-string">&apos;Example&apos;</span>)
<span class="hljs-keyword">true</span>
iex&gt; is_list(<span class="hljs-string">&quot;Example&quot;</span>)
<span class="hljs-keyword">false</span>
iex&gt; is_binary(<span class="hljs-string">&quot;Example&quot;</span>)
<span class="hljs-keyword">true</span>
iex&gt; &lt;&lt;<span class="hljs-string">&quot;Example&quot;</span>&gt;&gt; === <span class="hljs-string">&quot;Example&quot;</span>
<span class="hljs-keyword">true</span>
</code></pre>
<p>Erlang:  </p>
<pre><code class="lang-erlang"><span class="hljs-number">1</span>&gt; is_list(&apos;Example&apos;).
<span class="hljs-literal">false</span>
<span class="hljs-number">2</span>&gt; is_list(<span class="hljs-string">&quot;Example&quot;</span>).
<span class="hljs-literal">true</span>
<span class="hljs-number">3</span>&gt; is_binary(<span class="hljs-string">&quot;Example&quot;</span>).
<span class="hljs-literal">false</span>
<span class="hljs-number">4</span>&gt; is_binary(&lt;&lt;<span class="hljs-string">&quot;Example&quot;</span>&gt;&gt;).
<span class="hljs-literal">true</span>
</code></pre>
<p>&#x9700;&#x8981;&#x7279;&#x522B;&#x6CE8;&#x610F;&#x7684;&#x662F;&#xFF0C;&#x6709;&#x4E9B; Erlang &#x7684;&#x5E93;&#x4E0D;&#x652F;&#x6301;&#x4E8C;&#x8FDB;&#x5236;&#x6570;&#x636E;&#xFF0C;&#x6211;&#x4EEC;&#x8981;&#x628A; Elixir &#x5B57;&#x7B26;&#x4E32;&#x8F6C;&#x6362;&#x6210;&#x5B57;&#x7B26;&#x5217;&#x8868;&#x3002;&#x8FD8;&#x597D;&#xFF0C;<code>to_charlist/1</code> &#x51FD;&#x6570;&#x53EF;&#x4EE5;&#x5E2E;&#x6211;&#x4EEC;&#x8F7B;&#x677E;&#x5B8C;&#x6210;&#x8FD9;&#x4E2A;&#x8F6C;&#x6362;&#x3002;  </p>
<pre><code class="lang-elixir">iex&gt; <span class="hljs-symbol">:string</span>.words(<span class="hljs-string">&quot;Hello World&quot;</span>)
** (FunctionClauseError) no function clause matching <span class="hljs-keyword">in</span> <span class="hljs-symbol">:string</span>.strip_left/<span class="hljs-number">2</span>

    The following arguments were given to <span class="hljs-symbol">:string</span>.strip_left/<span class="hljs-number">2</span><span class="hljs-symbol">:</span>

        <span class="hljs-comment"># 1</span>
        <span class="hljs-string">&quot;Hello World&quot;</span>

        <span class="hljs-comment"># 2</span>
        <span class="hljs-number">32</span>

    (stdlib) string.<span class="hljs-symbol">erl:</span><span class="hljs-number">1661</span><span class="hljs-symbol">:</span> <span class="hljs-symbol">:string</span>.strip_left/<span class="hljs-number">2</span>
    (stdlib) string.<span class="hljs-symbol">erl:</span><span class="hljs-number">1659</span><span class="hljs-symbol">:</span> <span class="hljs-symbol">:string</span>.strip/<span class="hljs-number">3</span>
    (stdlib) string.<span class="hljs-symbol">erl:</span><span class="hljs-number">1597</span><span class="hljs-symbol">:</span> <span class="hljs-symbol">:string</span>.words/<span class="hljs-number">2</span>

iex&gt; <span class="hljs-string">&quot;Hello World&quot;</span> |&gt; to_charlist() |&gt; <span class="hljs-symbol">:string</span>.words()
<span class="hljs-number">2</span>
</code></pre>
<h3 id="&#x53D8;&#x91CF;">&#x53D8;&#x91CF;</h3>
<p>Elixir:  </p>
<pre><code class="lang-elixir">iex&gt; x = <span class="hljs-number">10</span>
<span class="hljs-number">10</span>

iex&gt; x1 = x + <span class="hljs-number">10</span>
<span class="hljs-number">20</span>
</code></pre>
<p>Erlang:  </p>
<pre><code class="lang-erlang"><span class="hljs-number">1</span>&gt; X = <span class="hljs-number">10</span>.
<span class="hljs-number">10</span>

<span class="hljs-number">2</span>&gt; X1 = X + <span class="hljs-number">1</span>.
<span class="hljs-number">11</span>
</code></pre>
<p>&#x5C31;&#x8FD9;&#x4E48;&#x591A;&#xFF01;&#x5728; Elixir &#x5E94;&#x7528;&#x4E2D;&#x4F7F;&#x7528; Erlang &#x7B80;&#x5355;&#x9AD8;&#x6548;&#xFF0C;&#x628A;&#x539F;&#x6765;&#x53EF;&#x7528;&#x7684;&#x5E93;&#x76F4;&#x63A5;&#x52A0;&#x500D;&#x5566;&#xFF01;  </p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../basics/iex-helpers.html" class="navigation navigation-prev " aria-label="Previous page: IEx辅助函数">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="error-handling.html" class="navigation navigation-next " aria-label="Next page: 错误处理">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"version":"1.0.1","title":"和Erlang互操作","level":"2.1","depth":1,"next":{"title":"错误处理","level":"2.2","depth":1,"path":"lessons/advanced/error-handling.md","ref":"lessons/advanced/error-handling.md","articles":[]},"previous":{"title":"IEx辅助函数","level":"1.18","depth":1,"path":"lessons/basics/iex-helpers.md","ref":"lessons/basics/iex-helpers.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"lessons/advanced/erlang.md","mtime":"2019-11-05T02:25:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-11-05T03:01:22.004Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

